import request from "@/utils/request";
import axios from "axios";
import store from "@/store";
import { getToken } from "@/utils/auth";

let token = "";

if (store.getters.token) {
  // let each request carry token
  // ['X-Token'] is a custom headers key
  // please modify it according to the actual situation
  token = getToken();
}

export default {
  getList(fileName, currentPage, pageSize) {
    return request({
      url: `/audio/getList`,
      method: "get",
      params: { fileName, currentPage, pageSize },
    });
  },
  getListForTest(fileName, currentPage, pageSize) {
    return request({
      url: `/audio/getListForTest`,
      method: "get",
      params: { fileName, currentPage, pageSize },
    });
  },
  getTotal(fileName) {
    return request({
      url: `/audio/getTotal`,
      method: "get",
      params: { fileName },
    });
  },
  update(data) {
    return request({
      url: `/audio/update`,
      method: "post",
      data,
    });
  },
  deleteById(id) {
    return request({
      url: `/audio/delete/${id}`,
      method: "post",
    });
  },
  getById(id) {
    return request({
      url: `/audio/getById/${id}`,
      method: "get",
    });
  },
  //查找audio_question表
  getAudioQuestionByName(name) {
    return request({
      url: `/audioQuestion/getAudioQuestionByName/${name}`,
      method: "get",
    });
  },
};
